import re
import sys
import datetime

string = '''10.162.65.31 - - [06/May/2021:18:25:43 +0800] arvatovch "POST /api/interface/third/va/member/queryMemberOrderList HTTP/1.1" 499 10.003 0 "-" "Jakarta Commons-HttpClient/3.1" "-"
127.0.0.1 - - [06/May/2021:18:25:43 +0800] arvatovch "POST /vchprod/third/member/queryMemberOrderList HTTP/1.1" 499 10.002 0 "-" "Jakarta Commons-HttpClient/3.1" "10.162.65.31"
10.162.65.30 - - [06/Nov/2021:18:29:01 +0800] connextys "POST /api/interface/third/va/member/queryMemberPointsDetailList HTTP/1.1" 499 10.001 0 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 Hutool" "-"'''


if __name__ == '__main__':
    lines = string.split('\n')
    times = [ re.findall( re.compile(r'(\d\d/.{3,10}/\d{4}:\d\d:\d\d:\d\d)'), line)[0] for line in lines]
    now = datetime.datetime.now()
    print(times)
    flag = True

    for i, v in enumerate(times):
        start = datetime.datetime.strptime(v,'%d/%b/%Y:%H:%M:%S')
        if (now - start).seconds < 10 * 60:
            print(len(times) - i)
            flag = False
            break

    if flag:
        print(0)

